﻿using UnityEngine;
using System.Collections;

public class DoorTrigger : MonoBehaviour {
	private door m_door;
	void Start () {
		m_door = GameObject.Find ("DoorParent").GetComponent<door> ();
	}

	void Update () {

	}

	void OnTiggerEnter(Collider coll){
		if (coll.gameObject.name == "Student") {
			m_door.OpenDoor ();
		}
	}

	void OnTiggerExit(Collider coll){
		if (coll.gameObject.name == "Student") {
			m_door.CloseDoor ();
		}
	}
}
